package com.victor.system.api;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.victor.common.core.constant.SecurityConstants;
import com.victor.common.core.constant.ServiceNameConstants;
import com.victor.common.core.domain.R;
import com.victor.common.entity.system.SysUser;
import com.victor.common.entity.vo.system.SysSystemVo;
import com.victor.common.response.system.SysUserResp;
import com.victor.system.api.factory.RemoteUserFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 用户服务
 */
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
public interface RemoteUserService {
    /**
     * 通过用户名查询用户信息
     *
     * @param username 用户名
     * @param source   请求来源
     * @return 结果
     */
    @GetMapping("/sysUser/getUser/{username}")
    public R<SysUser> getUserInfo(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/sysUser/getUserInfoByThirdNo")
    public R<SysUser> getUserInfoByThirdNo(@RequestParam("thirdNo") String thirdNo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping("/user/register")
    R<System> getSystemByUser(@RequestBody Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);


    /**
     * 注册用户信息
     *
     * @param sysUser 用户信息
     * @param source  请求来源
     * @return 结果
     */
    @PostMapping("/user/register")
    public R<Boolean> registerUserInfo(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/sysSystem/systemInfoByUserId")
    R<List<SysSystemVo>> systemInfoByUserId(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping("/sysUser/getMedicalAssistanceInfo")
    R<List<SysUserResp>> getMedicalAssistanceInfo(@RequestBody List<Integer> body, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/sysUser/getFamilyDoc")
    R<List<SysUserResp>> getFamilyDoc(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
